package org.example.frw.async;

import com.alibaba.ttl.TtlRunnable;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;

/**
 * 包装一层用于使用ttl修饰
 */
public class TransmittableThreadPoolTaskExecutor extends ThreadPoolTaskExecutor {

    @Override
    public void execute(Runnable task) {
        Runnable ttlRunnable = TtlRunnable.get(task);
        super.execute(ttlRunnable);
    }

    @Override
    public void execute(Runnable task, long startTimeout) {
        Runnable ttlRunnable = TtlRunnable.get(task);
        super.execute(ttlRunnable, startTimeout);
    }
}
